using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace VisualGTest.Binding
{
    class Program
    {
        // just a test program for now
        static void Main(string[] args)
        {
            IProcessFactory processFactory = new ProcessFactory();
            IPipeStreamFactory pipeFactory = new PipeStreamFactory();
            FileCapsule fileCapsule = new FileCapsule();
            Runner runner = new Runner(processFactory, pipeFactory, fileCapsule);

            runner.GTestRunnerPath = @"I:\work\visual-gtest\debug\gtest-runner.exe";
            runner.TestDllPath = @"I:\work\visual-gtest\testing\dll-tests\debug\dll-tests.dll";

            if (args.Length > 0 && args[0].ToLower() == "list")
            {
                List<TestId> tests = runner.ListTests();

                foreach (TestId test in tests)
                {
                    Console.WriteLine(test);
                }
            }
            else 
            {
                ITestEventListener listener = new TestEventListener();
                IAsyncResult asyncResult = runner.BeginTestRun(null, listener, null);

                runner.EndTestRun(asyncResult);
            }
        }
    }
}
